var tabActionArray = new Array();
var framesArray = new Array();

var orderIndex = 1;

var technicChartIndex = 2;

var colorIndex = 3;

var yarnIndex = 4;

//#####################################################################################################################
var orderRefreshAction = new Ext.Action({
    text: 'Refresh',
    handler: function(){
		var frame = document.getElementById(framesArray[orderIndex]);
		frame.contentWindow.location.reload();
    },
    iconCls: 'actionRefresh'
});
var orderListAction = new Ext.Action({
    text: 'Order list',
    handler: function(){
        document.getElementById(framesArray[orderIndex]).src = 'order_list.html';
    },
    iconCls: 'actionList'
});

var orderAddAction = new Ext.Action({
    text: 'Add order',
    handler: function(){
        document.getElementById(framesArray[orderIndex]).src = 'order_edit.html';
    },
    iconCls: 'actionAdd'
});

tabActionArray[orderIndex] = [orderListAction, orderAddAction, '-', orderRefreshAction];

//#####################################################################################################################
var technicChartRefreshAction = new Ext.Action({
    text: 'Refresh',
    handler: function(){
		var frame = document.getElementById(framesArray[technicChartIndex]);
		frame.contentWindow.location.reload();
    },
    iconCls: 'actionRefresh'
});
var technicChartListAction = new Ext.Action({
    text: 'Technic chart list',
    handler: function(){
        document.getElementById(framesArray[technicChartIndex]).src = 'technic_chart_list.html';
    },
    iconCls: 'actionList'
});

var technicChartAddAction = new Ext.Action({
    text: 'Add technic chart',
    handler: function(){
        document.getElementById(framesArray[technicChartIndex]).src = 'technic_chart_edit.html';
    },
    iconCls: 'actionAdd'
});

tabActionArray[technicChartIndex] = [technicChartListAction, technicChartAddAction, '-', technicChartRefreshAction];

//#####################################################################################################################
var colorRefreshAction = new Ext.Action({
    text: 'Refresh',
    handler: function(){
		var frame = document.getElementById(framesArray[colorIndex]);
		frame.contentWindow.location.reload();
    },
    iconCls: 'actionRefresh'
});
var colorListAction = new Ext.Action({
    text: 'Color list',
    handler: function(){
        document.getElementById(framesArray[colorIndex]).src = 'color_list.html';
    },
    iconCls: 'actionList'
});

var colorAddAction = new Ext.Action({
    text: 'Add color',
    handler: function(){
        document.getElementById(framesArray[colorIndex]).src = 'color_edit.html';
    },
    iconCls: 'actionAdd'
});

tabActionArray[colorIndex] = [colorListAction, colorAddAction, '-', colorRefreshAction];

//#####################################################################################################################
var yarnRefreshAction = new Ext.Action({
    text: 'Refresh',
    handler: function(){
		var frame = document.getElementById(framesArray[yarnIndex]);
		frame.contentWindow.location.reload();
    },
    iconCls: 'actionRefresh'
});
var yarnListAction = new Ext.Action({
    text: 'Yarn list',
    handler: function(){
        document.getElementById(framesArray[yarnIndex]).src = 'yarn_list.html';
    },
    iconCls: 'actionList'
});

var yarnAddAction = new Ext.Action({
    text: 'Add yarn',
    handler: function(){
        document.getElementById(framesArray[yarnIndex]).src = 'yarn_edit.html';
    },
    iconCls: 'actionAdd'
});

tabActionArray[yarnIndex] = [yarnListAction, yarnAddAction, '-', yarnRefreshAction];

var getTabAction = function(frameId, menuId){
	framesArray[menuId] = frameId;
	return tabActionArray[menuId];
}
